﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Fitts__law_experiment_with_a_wiimote
{
	public partial class Experiment1DHR : Fitts__law_experiment_with_a_wiimote.ExperimentForm
	{
		private Random rand = new Random();
		private int maxWidth = 1280;
		public Experiment1DHR()
		{
			InitializeComponent();
			SetExperiment(new Experiment("Random horizontal movement", PrimaryButton, SecondaryButton));
		}

		private void Experiment1DHR_Load(object sender, EventArgs e)
		{
			
		}

		protected override void onMousePrimaryButtonClick()
		{
			SecondaryButton.Width = rand.Next(75, 250);
			SecondaryButton.Height = rand.Next(75, 250);

			int offset = Math.Max(0, this.Width - maxWidth) / 2;
			int width = Math.Min(maxWidth, this.Width);
			SecondaryButton.Left = offset + rand.Next(width / 2, width - SecondaryButton.Width);
		}

		protected override void onMouseSecondaryButtonClick()
		{
			PrimaryButton.Width = rand.Next(75, 250);
			PrimaryButton.Height = rand.Next(75, 250);

			int offset = Math.Max(0, this.Width - maxWidth) / 2;
			int width = Math.Min(maxWidth, this.Width);
			PrimaryButton.Left = offset + rand.Next(0, width / 2 - PrimaryButton.Width);
		}

		protected override void onProceedExperiment()
		{
			dontExit = true;
			Close();
			Experiment1DVR form = new Experiment1DVR();
			form.Show();
		}
	}
}
